import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Form, Input, Button } from 'antd'
import { InputItem } from 'antd-mobile'

import Navleft from '../Navleft'
import styles from './index.less'

const FormItem = Form.Item
class Map extends Component {
  handleSubmit = () => {
    this.props.form.validateFields()
  }
  render() {
    const { getFieldDecorator } = this.props.form
    return (
      <div>
        <div className={styles.navlist}>
          <Navleft />
        </div>
        <Form className={styles.mapForm} onSubmit={this.handleSubmit}>
          <FormItem>
            {getFieldDecorator('userName', {
              rules: [
                {
                  require: true,
                  message: 'Please input you username'
                }
              ]
            })(<Input placeholder="user name" />)}
          </FormItem>
          <FormItem>
            {getFieldDecorator('psw', {
              rules: [
                {
                  require: true,
                  message: 'Please input you password'
                }
              ]
            })(<Input placeholder="passWorld" />)}
          </FormItem>
          <FormItem>
            <Button type="primary">log in</Button>
          </FormItem>
        </Form>

        <InputItem placeholder="input item" />
      </div>
    )
  }
}

Map.propTypes = {
  form: PropTypes.object
}

export default Form.create()(Map)
